package smartcampus.scjava.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import smartcampus.scjava.POJO.DO.Schedule;
import smartcampus.scjava.POJO.DO.Student;
import smartcampus.scjava.service.ScheduleService;
import smartcampus.scjava.mapper.ScheduleMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 苟森
 * @description 针对表【schedule(课程详情表)】的数据库操作Service实现
 * @createDate 2023-11-24 16:42:13
 */
@Service
public class ScheduleServiceImpl extends ServiceImpl<ScheduleMapper, Schedule>
        implements ScheduleService {
    @Autowired
    ScheduleMapper scheduleMapper;

    @Override
    public Boolean insertSchedule(Schedule schedule) {
        int a = scheduleMapper.insert(schedule);
        if (a > 0) {
            return true;
        } else {
            return false;
        }

    }

    @Override
    public int delBycourseid(int courseid) {
        return scheduleMapper.delBycourseid(courseid);
    }

    @Override
    public List<Schedule> findAll() {
        QueryWrapper<Schedule> queryWrapper = new QueryWrapper<Schedule>();
        return scheduleMapper.selectList(queryWrapper);
    }

    @Override
    public boolean updateBycourseid(Schedule schedule) {
        return scheduleMapper.updateBycourseid(schedule);

    }


}




